﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace WebIMServer.Filters
{
    /// <summary>
    /// 用于身份验证过滤器
    /// </summary>
    public class IMAuthenticateFilterAttribute : AuthorizeAttribute
    {
        public override void OnAuthorization(AuthorizationContext filterContext)
        {
            if (filterContext.HttpContext.Session[Constant.UserInfoSessionKey] == null)
            {
                filterContext.HttpContext.Response.Redirect((filterContext.Controller as Controller).Url.Action("GoLogin", "User"));
            }
        }
    }
}
